package com.pet.server.dao.common;

import java.util.List;

import com.pet.framework.page.Page;
import com.pet.server.po.Article;
import com.pet.server.po.ArticleTemp;
import com.pet.server.po.Subject;
import com.pet.system.constants.ATTSystem;
import com.pet.system.statement.Statement;

public class ArticleDao extends CommonDao {

	public void searchArticle(Page page,Article article){
		Statement stms = stmsFactory.createStatement("from Article a where 1=1 and  state!=4");
		if(article!=null){
			
		}
		stms.addOrderBy("a.articleId desc ");
		search(stms, page);
	}
	public void searchArticleTemp(Page page,ArticleTemp article){
		Statement stms = stmsFactory.createStatement("from ArticleTemp a where 1=1 and  state!=4");
		if(article!=null){
			
		}
		stms.addOrderBy("a.articleId desc ");
		search(stms, page);
	}
	
	public void searchSubject(Page page,Subject subject){
        Statement stms = stmsFactory.createStatement("from Subject sub where 1=1 and  state!=4");
        if(subject!=null){
        	stms.appendLike(null, "and", "sub.title", subject.getTitle());
        }
        stms.addOrderBy(" sub.id desc");
        search(stms, page);
	}
	public List<Subject> querySubject(){
        Statement stms = stmsFactory.createStatement(" from Subject sub where sub.state=?");
                  stms.addParam(ATTSystem.LOGIC_TRUE);
                  stms.addOrderBy("sub.id desc");
        return query(stms);
	}
	
}
